package com.ruoyi.common.utils;

public class ResponseData {
    private int stateCode; //状态码 200 404
    private String state;//状态
    private Object data;//数据
    private int total;//总条数

    public int getStateCode() {
        return stateCode;
    }

    public void setStateCode(int stateCode) {
        this.stateCode = stateCode;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }
    public ResponseData(int stateCode, String state, Object data, int total) {
        this.stateCode = stateCode;
        this.state = state;
        this.data = data;
        this.total = total;
    }

    public ResponseData() {
    }

    public  static ResponseData ok(){
        return new ResponseData(0,"success",null,0);
    }
    public  static ResponseData ok(String text){
        return new ResponseData(0,"success",text,0);
    }
    public  static ResponseData error(){
        return new ResponseData(-1,"error",null,0);
    }
    public  static ResponseData error(String text){
        return new ResponseData(-1,"error",text,0);
    }
    public static ResponseData error(int stateCode,String text){
        return new ResponseData(stateCode,"error",text,0);
    }
}
